Birmingham | ITP-Jan | Roman Sanaye | Sprint 2 | Module-Structuring-and-Testing-Data coursework#978
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Your solutions are all good, but several times you have left console.log calls within the function. Is this in line with best practices?
| // =============> write your new code here | ||
| function convertToPercentage(decimalNumber) { | ||
| const percentage = `${decimalNumber * 100}%`; | ||
| console.log(`Your Decimal number will be ${percentage}.`); |
There was a problem hiding this comment.
Can you imagine any issues that might happen by including this console.log here inside the function?
Would you want it to always print to the console every time you run this function?
| } No newline at end of file | ||
| let heightSquare = height * height; | ||
| let bmi = weight / heightSquare; | ||
| console.log(`Your BMI is ${bmi.toFixed(1)}`) |
There was a problem hiding this comment.
See my earlier comment. Leaving console.log statements inside functions might not be the best approach
| // This is the latest solution to the problem from the prep. | ||
| // Make sure to do the prep before you do the coursework | ||
| // Your task is to write tests for as many different groups of input data or edge cases as you can, and fix any bugs you find. | ||
| // --- > Debugging this code was not easy for me, I could solve this by the help of AI Explaining each step and conditions and finally we made it work well with different inputs, I mean string with number character. |
There was a problem hiding this comment.
Using AI to help at this stage can help you get a feel for the javascript, you might want to try doing this again by yourself - with no AI help - to make sure you learned the steps needed. For now though, the solution you have found works well.
Learners, PR Template
Self checklist
Changelist
Reviewed and worked through all JS files in the following folders:
Made predictions, explained code, and debugged issues where needed
In 5-stretch-extend, handled edge cases in
formatAs12HourClock(midnight, noon, leading zeros) and added comprehensive testsAll files have been reviewed and tested; outputs are verified